package com.wis.controller;

import com.wis.entity.CourseEntity;
import com.wis.entity.TeacherEntity;
import com.wis.service.TeacherService;
import com.wis.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;
    @GetMapping("/selectTeacherOnPage")
    public CommonResult selectTeachers() {
        return teacherService.selectTeacherOnPage();
    }

    @PostMapping("/delOneTeacher/{id}")
    public CommonResult delOneTeacher(@PathVariable Integer id) {
        return teacherService.delOneTeacher(id);
    }

    @GetMapping("/showTeacherByName/{name}")
    public CommonResult showTeacherByName( @PathVariable String name) {
        return teacherService.showTeacherByName(name);
    }

    @PostMapping("/updateTeacher")
    public CommonResult updateTeacher(@RequestBody TeacherEntity teacher) {
        return teacherService.updateTeacher(teacher);
    }
}
